package com.sicheng.lc.周赛.分类.模拟;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/7/17 10:32
 */
public class 数组能形成多少数对 {
    //https://leetcode.cn/problems/maximum-number-of-pairs-in-array/
    public int[] numberOfPairs(int[] nums) {
        int[] cnt = new int[101];
        int x = 0, y = 0;
        for (int num : nums) {
            cnt[num]++;
        }

        for (int j : cnt) {
            x += j / 2;
            y += j % 2;
        }
        return new int[]{x, y};
    }
}
